<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 2.计算两个文本框的加减乘除 文本框 + 文本框 按钮（=） 文本框（结果） 提示：可以通过 input.value = "值" 来设置 input里的值。 -->
    <input class="one" type="text">
    <select class="type">
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
    </select>
    <input class="two" type="text">
    <button class="btn">=</button>
    <input class="res" type="text" disabled>
    <script>
        var one = document.getElementsByClassName("one")[0];
        var two = document.getElementsByClassName("two")[0];
        var res = document.getElementsByClassName("res")[0];
        var btn = document.getElementsByClassName("btn")[0];
        var type = document.getElementsByClassName("type")[0]
        btn.onclick=function(){
            if(type.value == "+"){
                res.value = (Number(one.value)+Number(two.value))
            }
            else if(type.value == "-"){
                res.value = (Number(one.value)-Number(two.value))
            }
            else if(type.value == "*"){
                res.value = (Number(one.value)*Number(two.value))
            }
            else{
                res.value = (Number(one.value)/Number(two.value))
            }
        }
    </script>
</body>
</html>